package com.example.backend.service.impl;

import com.example.backend.mapper.AddressMapper;
import com.example.backend.pojo.Address;
import com.example.backend.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ProjectName: mall-project
 * @Titile: AddressServiceImpl
 * @Author: Lucky
 * @Description: 地址业务类
 */
@Service
public class AddressServiceImpl implements AddressService {
    @Autowired
    private AddressMapper addressMapper;
    @Override
    public List<Address> getProvinces() {
        return addressMapper.getProvinces();
    }

    @Override
    public List<Address> getCities(Integer addressRegionId) {
        return addressMapper.getCities(addressRegionId);
    }

    @Override
    public Address getCityname(Integer addressareaid) {
        return addressMapper.getCity(addressareaid);
    }

    @Override
    public String getallname(Integer addressareaid) {
        Address qu = addressMapper.getCity(addressareaid);
        Address shi = addressMapper.getCity(Integer.valueOf(qu.getAddressregionid()));
        Address shen=addressMapper.getCity(Integer.valueOf(shi.getAddressregionid()));
        return shen.getAddressname()+shi.getAddressname()+qu.getAddressname();
    }

}
